package com.datastructure.test.primescount;

public class PrimesCount {

    public static void main(String[] args) {

    }

    public int num;
    public int primesCount (int n) {
        // write code here
        if(n<2){
            return 0;
        }
        for (int i = 2; i < n; i++) {
            if(computePrimesCount(i)){
                num++;
            }
        }
        return num;
    }

    private boolean computePrimesCount(int i) {
        for (int j = 2; j < i-1; j++) {
            if(i%j==0){
                return false;
            }
        }
        return true;
    }
}
